import requests


class SendSessionRequest:
    """使用session鉴权的接口，记录cookies/token"""

    def __init__(self):
        self.session = requests.session()

    def requests(self, url, method, params=None, data=None, json=None, headers=None):
        method = method.lower()
        if method == "post":
            return self.session.post(url=url, json=json, data=data, headers=headers)
        elif method == "patch":
            return self.session.patch(url=url, json=json, data=data, headers=headers)
        elif method == "get":
            return self.session.get(url=url, params=params)